﻿@namespace SwashbucklerDiary.Components
@inherits FocusDialogComponentBase

<MMDialog MyValue="Value"
          MyValueChanged="InternalValueChanged"
          MaxWidth="480"
          @ref="myDialog">
    <MForm @ref="@form"
           Model="@model"
           OnValidSubmit="HandleOnOK"
           EnableValidation="true"
           EnableI18n="true">
        <MCard Rounded="@("lg")">
            <MCardTitle Class="font-weight-bold">
                @(Title)
                <MSpacer></MSpacer>
                <MButton Icon="true" OnClick="HandleOnCancel">
                    <MIcon>
                        mdi-close
                    </MIcon>
                </MButton>
            </MCardTitle>
            <MCardText Class="pb-0">
                <MTextField @bind-Value="model.Password"
                            @ref="TextField"
                            Dense="true"
                            HideDetails="@("auto")"
                            Outlined="true"
                            Counter="@MaxLength"
                            maxlength="@MaxLength"
                            spellcheck="false"
                            Placeholder="@(I18n.T("Please input a password"))"
                            AppendIcon="@(showPassword1 ? "mdi-eye" : "mdi-eye-off")"
                            Type="@(showPassword1 ? "text" : "password")"
                            OnAppendClick="() => showPassword1 = !showPassword1">
                </MTextField>
                <MTextField @bind-Value="model.PasswordConfirmation"
                            Dense="true"
                            Outlined="true"
                            Counter="@MaxLength"
                            maxlength="@MaxLength"
                            spellcheck="false"
                            Placeholder="@(I18n.T("Please enter the password again"))"
                            AppendIcon="@(showPassword2 ? "mdi-eye" : "mdi-eye-off")"
                            Type="@(showPassword2 ? "text" : "password")"
                            OnAppendClick="() => showPassword2 = !showPassword2">
                </MTextField>
            </MCardText>
            <MCardActions>
                <MSpacer></MSpacer>
                <MButton Text="true" OnClick="HandleOnCancel">
                    @(I18n.T("Share.Cancel"))
                </MButton>
                <MButton Text="true"
                         Type="submit"
                         Color="primary">
                    @(I18n.T("Share.Save"))
                </MButton>
            </MCardActions>
        </MCard>
    </MForm>
</MMDialog>